1. Field of the Invention
The present invention relates to a code reading apparatus and a computer program product.
2. Background Art
Conventionally, there is known a code reading apparatus which decodes a symbol such as a one-dimensional barcode or a two-dimensional code to obtain information. In the code reading apparatus, a two-dimensional imager device is installed. The two-dimensional imager device optically picks up (captures) an image of a symbol, and decodes the symbol by using the picked-up image data so as to obtain data.
In order to read a code by a code reading apparatus, it is necessary to execute focus processing to adjust the focal position of a lens optical system used for image pickup to a symbol as a reading subject. As the focus processing, there are known focus processing to change, using a fixed focal lens, a distance from the lens to a reading subject; and focus processing to change, using a variable focal lens, a focal position of the lens. As the focus processing using a fixed focal lens, for example, Japanese Patent Application Laid-Open Publication No. 2001-184452 discloses a technology with which a moving direction of a barcode symbol as a reading subject or a barcode reading apparatus is indicated by changing patterns of light emission or a sound, so that a user can promptly place the barcode symbol and the barcode reading apparatus at appropriate relative positions.
On the other hand, in a barcode reading apparatus using a variable focal lens, the focal position is adjusted by automatic focusing. As an autofocus method, for example, Japanese Patent Application Laid-Open Publication No. hei 05-217013 discloses a laser focus method which includes emitting a spotter beam of laser light to an optical axis of a lens at a predetermined angle, and measuring a distance to a reading subject based on a position of an image of the spotter beam (bright point) formed on a code plane, so as to execute focus adjustment of the lens. Furthermore, as another autofocus method, there is a method which includes picking up images of a symbol as a reading subject successively while changing focal positions in turn, and searching for a focused image based on a characteristic value (for example, a contrast value of an image) of each picked-up image data so as to identify the focal position, thereby executing focus adjustment of the lens (a contrast focus method or the like). The focus processing with the laser focus method can be executed taking a shorter period of time as compared with the focus processing with the contrast focus method. However, the contrast focus method is better than the laser focus method in the accuracy of automatic focusing.
Then, there is a barcode reading apparatus having an autofocus function using both the laser focus method and the contrast focus method installed therein. In the barcode reading apparatus, focus processing and decoding processing are repeated, each processing being executed for a predetermined period of time, until decoding succeeds with either of the autofocus methods. In addition, in such focus processing, the focal position is obtained asymptotically in general. Hence, a technology is used, the technology with which each time the focus processing is executed, a predetermined focus time is gradually reduced, so that unnecessary focus time is decreased, and the reading speed of code data becomes higher.
However, as described above, the laser focus method and the contrast focus method are different in time required for focus processing. Hence, decoding cannot be executed efficiently when a predetermined focus time is uniformly reduced each time the focus processing is executed.